package com.ncmmall.domain.business.order.delivery;

import com.fasterxml.jackson.annotation.JsonBackReference;
import com.ncmmall.domain.business.order.Order;
import com.google.common.collect.Lists;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;

/**
 * @author linxs
 * @Description: 采购订单发货记录
 * @Date: 2020-05-10 18:48
 */
@Entity
@Table(name = "mall_order_delivery")
@Access(AccessType.FIELD)
@Getter
@Setter
public class SupplierOrderDelivery {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private long id;

    /**
     * 所属订单
     */
    @JsonBackReference
    @OneToOne
    private Order order;

    /**
     * 快递公司
     */
    private String expressCompany;

    /**
     * 快递公司编号
     */
    private String expressCompanyCode;

    /**
     * 快递单号
     */
    private String expressNo;

    /**
     * 发货时间
     */
    private Timestamp createTime;

    /**
     * 发货清单
     */
    @OneToMany(fetch = FetchType.EAGER)
    @JoinColumn(name = "delivery_id", nullable = true)
    private List<SupplierOrderDeliveryDetail> details = Lists.newArrayList();

}
